<template>
  <div id="userLayout" :class="['user-layout-wrapper', device]">
    <div class="container">
      <div class="top">
        <div class="header" style="position: absolute;left: 20px;top: 20px;">
        </div>
      </div>
      <route-view></route-view>
    </div>

    <div class="banner_div">
      <div class="banner">
        <div class="bannerImg">
          <transition-group tag="div">
            <span v-for="(v,i) in banners" :key="v" :style="{opacity: i == n ? '1' : '0' }" class="active">
              <img :src="v"  style="display:block;width:100%;height:100%;object-fit:cover">
            </span>
          </transition-group>
        </div>
      </div>

      <route-view></route-view>

      <div class="footer">
        <div class="copyright">
          Copyright &copy; 2022 <a href="tel:18684927986">thankgod7</a> 出品
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import RouteView from "@/components/layouts/RouteView"
  import { mixinDevice } from '@/utils/mixin.js'

  export default {
    name: "UserLayout",
    components: { RouteView },
    mixins: [mixinDevice],
    data () {
      return {
        banners:[require('@/assets/banner_01.jpg'),require('@/assets/banner_02.jpg')],
        n:0,　　　　　　　// 图片的index。
      }
    },
    mounted () {
      document.body.classList.add('userLayout')
      this.timer3 = setInterval(this.next,3000);
    },
    beforeDestroy () {
      document.body.classList.remove('userLayout')
    },
    methods:{
      next(){
        this.n = this.n + 1 == 2 ? 0 : this.n + 1;
      },
    },
  }
</script>

<style lang="less" scoped>

  #userLayout.user-layout-wrapper {
    height: 100%;

    &.mobile {
      .container {
        .main {
          max-width: 368px;
          width: 98%;
        }
      }
    }

    .container {
      width: 100%;
      min-height: 100%;
      background-size: 100%;
      padding: 110px 0 144px;
      position: relative;

      a {
        text-decoration: none;
      }

      .top {
        text-align: center;

        .header {
          height: 44px;
          line-height: 44px;

          .badge {
            position: absolute;
            display: inline-block;
            line-height: 1;
            vertical-align: middle;
            margin-left: -12px;
            margin-top: -10px;
            opacity: 0.8;
          }

          .logo {
            height: 44px;
            vertical-align: top;
            margin-right: 16px;
            border-style: none;
          }

          .title {
            font-size: 33px;
            color: rgba(0, 0, 0, .85);
            font-family: "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
            font-weight: 600;
            position: relative;
            top: 2px;
          }
        }
        .desc {
          font-size: 14px;
          color: rgba(0, 0, 0, 0.45);
          margin-top: 12px;
          margin-bottom: 40px;
        }
      }

      .main {
        min-width: 260px;
        width: 320px;
        position: fixed;
        right: 8.8%;
        top: 191px
        // margin: 0 auto;
      }

      .footer {
        position: absolute;
        width: 100%;
        bottom: 0;
        padding: 0 16px;
        margin: 48px 0 24px;
        text-align: center;

        .links {
          margin-bottom: 8px;
          font-size: 14px;
          a {
            color: rgba(0, 0, 0, 0.45);
            transition: all 0.3s;
            &:not(:last-child) {
              margin-right: 40px;
            }
          }
        }
        .copyright {
          color: rgba(0, 0, 0, 0.45);
          font-size: 14px;
        }
      }
    }
  }
</style>
<style scoped>
.banner_div{
    position: fixed;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    z-index: -1
}
.banner{
  position: relative;
  width: 100%;
  height: 100%;
}
.bannerImg{
    position: relative;
    height: 100%;
    overflow: hidden;
}
.bannerImg span{
    position: absolute;
    top:0;
    left: 0;
    width:100%;
    height: 100%
}
.bannerImg span.active{
    transition:all 1s;
}
.bgimg {width: 100%;height: 100%;display: block;
  background-size: 100% 100%;
  background-repeat: repeat
}
.slogan{
  color: white;position: fixed;font-size: 35px;left: 90px;top: 276px;text-shadow: 5px 5px 5px rgba(0,0,0,0.4);
}
.subtitle{
  color: white;
  position: relative;
  top: 23px;
  left: -258px;
}
@media screen and (max-width: 576px) {
    #userLayout.user-layout-wrapper  .header .title {
      font-size: 23px!important
    }
    #userLayout.user-layout-wrapper .main{
      top:19%!important;
      right: 50%!important;
      transform: translateX(50%);
      width: 89%!important
    }
    #userLayout.user-layout-wrapper .slogan{
      top:11%!important;
      font-size: 21px!important
    }
    #userLayout.user-layout-wrapper .subtitle{
      left: -413px!important;
    }
}
@media screen and (min-width:576px) and (max-width:768px){
  #userLayout.user-layout-wrapper  .header .title {
      font-size: 23px!important
    }
    #userLayout.user-layout-wrapper .slogan{
      top:11%!important;
      font-size: 21px!important;
      width: 158px
    }
    #userLayout.user-layout-wrapper .subtitle{
      left: -258px!important;
    }
}
</style>